package com.nineclock.system.controller;


import com.nineclock.common.entity.Result;
import com.nineclock.system.dto.SysCompanyUserDTO;
import com.nineclock.system.service.SysCompanyUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*
* 企业员工管理接口控制器
* */
@RestController
@Api(value = "企业员工管理接口",tags = "系统服务",description = "企业员工管理接口")
@RequestMapping("companyUser")
public class SysCompanyUserController {
    @Autowired(required = false)
    SysCompanyUserService companyUserService;

    /*
    * 根据系统用户ID、企业id查询员工列表
    * ocmpanId:可能不需要
    * @RequestParam(required = false):非必要
    * */
    @ApiOperation(value = "根据系统用户ID、企业id查询员工列表")
    @GetMapping("query")
    public Result<List<SysCompanyUserDTO>> queryCompanyUser(@RequestParam Long userId,
                                                            @RequestParam(required = false) Long companyId){

        List<SysCompanyUserDTO> companyUserDTOList = companyUserService.queryCompanyUser(userId,companyId);
        return Result.success(companyUserDTOList);
    }

}
